import React from 'react'
// BrowserRouter声明路由模块，Link路由跳转，Router做路径和组件的匹配
import { BrowserRouter as Router, Link, Route, Routes,Navigate } from 'react-router-dom'
import Index from './pages/index'
import List from './pages/list'
import Home from './pages/Home'


function AppRouter() {
    return (
        <Router>
            <ul>
                <li><Link to='/'>首页</Link></li>
                <li><Link to='/list/123'>列表项</Link></li>
            </ul>

            <Routes>
            <Route path='/' element={<Index/>}></Route>
            <Route path='/list/:id' element={<List/>}></Route>
            <Route path='/home' element={<Home/>}></Route>
            <Route path='*' element={<Navigate to='/home'/>}></Route>
            </Routes>
        </Router>
    )
}


export default AppRouter